package org.ovirt.microvirt.beans;

import javax.persistence.Column;
import javax.persistence.DiscriminatorColumn;
import javax.persistence.DiscriminatorType;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlAttribute;

import org.hibernate.search.annotations.Indexed;

@Entity
@Table()
@Inheritance(strategy = InheritanceType.JOINED)
@DiscriminatorColumn(discriminatorType = DiscriminatorType.STRING, name = "type", length = 8)
@Indexed
public abstract class VirtualMachineBase {
	@Id
	@Column(name = "mname")
	String name;
	@Column(name = "memory_mb")
	int memory;
	@Column(name = "consoletype")
	@Enumerated(EnumType.STRING)
	ConsoleType consoleType;

	@Column(name = "cpus")
	int processors;
	
	@XmlAttribute(name = "name")
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@XmlAttribute(name = "ram")
	public int getMemory() {
		return memory;
	}

	public void setMemory(int memory) {
		this.memory = memory;
	}

	@XmlAttribute(name = "console")
	public ConsoleType getConsoleType() {
		return consoleType;
	}

	public void setConsoleType(ConsoleType consoleType) {
		this.consoleType = consoleType;
	}

	@XmlAttribute(name="cpus")
	public int getProcessors() {
		return processors;
	}

	public void setProcessors(int processors) {
		this.processors = processors;
	}
}
